#include "arch.h"
#include "kernel.h"
#include "error.h"
#include "interrupt.h"
#include "common.h"
#include "slab.h"
#include "printk.h"

extern unsigned char OS_RUNNING;

static unsigned int cirtical_lock = 0;

void kernel_disable_irq()
{
    arch_disable_irq();
 }

void kernel_enable_irq()
{
    arch_enable_irq();
}

void enter_critical()
{
    cirtical_lock++;
    arch_disable_irq();
}


void exit_critical()
{
    if (cirtical_lock > 0)
        cirtical_lock--;
    
    if (cirtical_lock)
        return;

    arch_enable_irq();
}
